const timeFormat2 = (time)=>{
  let thisTime = new Date().getTime(),
    timeObj = new Date(time),
    hours = timeObj.getHours(),
    minutes = timeObj.getMinutes(),
    timeStr = `${hours < 10 ? '0' + hours : hours}:${minutes < 10 ? '0' + minutes : minutes}`,
    thisTime0 = new Date(new Date(thisTime).setHours(0, 0, 0, 0)).getTime(),
    time0 = new Date(new Date(time).setHours(0, 0, 0, 0)).getTime(),
    dayDiff = Math.floor((thisTime0 - time0)/86400000),
    month = timeObj.getMonth() + 1,
    day = timeObj.getDate();

  if(dayDiff <= 2) {
    return ['今天', '昨天', '前天'][dayDiff] + timeStr
  }
  return `${timeObj.getFullYear()}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day} ${timeStr}`
}
export {
  timeFormat2
}
